﻿using Prism.Commands;
using Prism.Mvvm;
using Prism.Services.Dialogs;
using System;

namespace XeMail.Schedule.ViewModels
{
    public class ScheduleViewModel : BindableBase
    {
        private string _message;
        public string Message
        {
            get { return _message; }
            set { SetProperty(ref _message, value); }
        }


        private DelegateCommand _showDialogCommand;
        private readonly IDialogService _dialogService;

        public ScheduleViewModel(IDialogService dialogService)
        {
            Message = "计划—Prism";
            _dialogService = dialogService;
        }

        public DelegateCommand ShowDialogCommand
        {
            get => _showDialogCommand = new DelegateCommand(ShowDialogAction);
        }

        private void ShowDialogAction()
        {
            _dialogService.ShowDialog("MessageDialogView", (r) =>
            {
                var result = r.Result;

                if (result == ButtonResult.OK)
                {
                    var parameter = r.Parameters.GetValue<string>("MessageContent");
                };
            });
        }
    }
}
